package com.lingxin.gps.wap.command;

import com.alibaba.fastjson.JSONObject;
import com.lingxin.gps.sdk.GpsDeviceApi;
import com.pisces.core.Assert;
import com.pisces.core.BaseCommand;

/**
 *
 */
public class CDeviceDetail extends BaseCommand {

	/**
	 * 设备号
	 */
	private String deviceCode;

	private Long uid;
	private String token;

	@Override
	public void init() throws Exception {
		deviceCode = getPara("deviceCode");
		Assert.notBlank(deviceCode, "设备号不能为空");

		uid = context.getAttr("uid");
		token = context.getAttr("token");
	}

	@Override
	public void doCommand() throws Exception {
		JSONObject resData = GpsDeviceApi.deviceDetail(uid, token, deviceCode);
		data.put("device", resData.getJSONObject("device"));
	}

}
